import { createI18n } from 'vue-i18n'

// 自己的包
import zh from './lang/zh-cn'
import en from './lang/en'

// Element 语言包
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import English from 'element-plus/es/locale/lang/en'

const messages = {
  'zh-cn': {
    el: zhCn,
    ...zh
  },
  en: {
    el: English,
    ...en
  }
}

const i18n = createI18n({
  // 初始化配置语言
  locale: localStorage.getItem('lang') || 'zh-cn',
  messages
})

export default i18n
